import Vue from "vue";
// import "normalize.css/normalize.css"; // A modern alternative to CSS resets
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "@/styles/index.scss"; // global css
import App from "./App";
import store from "./store";
import router from "./router";
import settings from "@/settings";
import "@/icons"; // icon
import "@/permission"; // permission control
import { arrConverObj, downLoadXls } from "@/utils/index";
import permission from "./directive/permission";
import dragDialog from "./directive/el-drag-dialog";
// import "echarts";
// import ECharts from "vue-echarts";
// import "echarts/lib/chart/pie";
// import "echarts/lib/component/tooltip";
// import "echarts/lib/component/title";
// import "echarts/lib/component/legend";
// import "echarts/lib/chart/line";
// import "echarts/lib/chart/bar";

// 安装自定义指令
Vue.use(permission);
Vue.use(dragDialog);
Vue.use(ElementUI, {
  size: "medium", // set element-ui default size
});
Vue.prototype.Global = settings;

Vue.config.productionTip = false;
Vue.prototype.$arrConverObj = arrConverObj;
Vue.prototype.$downLoadXls = downLoadXls;
// Vue.component("v-chart", ECharts);

// 以下为一些全局过滤器
Vue.filter("encryptAddress", (val) => {
  if (val) {
    let arr = val.split("");
    return arr
      .map((item, index) => {
        return arr.length - index < 10 ? "*" : item;
      })
      .join("");
  } else {
    return val;
  }
});

Vue.filter("encryptReceiverName", (val) => {
  if (val) {
    let arr = val.split("");
    return arr
      .map((item, index) => {
        return index > 0 ? "*" : item;
      })
      .join("");
  } else {
    return val;
  }
});

Vue.filter("encryptMobile", (val) => {
  if (val) {
    let arr = val.split("");
    return arr
      .map((item, index) => {
        return index > 3 ? "*" : item;
      })
      .join("");
  } else {
    return val;
  }
});

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
